package org.simple.learning.springbootredis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目名称：spring-boot-learning
 * 类名称：WebController
 * 类描述：WebController
 * 创建时间：2019/5/9
 *
 * @author guihuo   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
@RestController
public class WebController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @RequestMapping("/emoji")
    public String emoji() {
        return "\uD83D\uDE42";
    }

    @RequestMapping("/emoji/redis")
    public String emojiRedis() {
        return stringRedisTemplate.opsForValue().get("sisyphus");
    }

    @RequestMapping("/emoji/redis/init")
    public String emojiRedisInit() {
        stringRedisTemplate.opsForValue().set("sisyphus", "\uD83D\uDE42");
        return "0";
    }

}
